#include "d3dApp.h"
#include <vector>
#include <list>
#include <deque>

class ContentManager;
class Level;
class GraphCamera;
class Character;
class TriggerRegion;
class SpherePNT;
class FullScreenQuad;
class DrawableTex2D;
class Blur;
class SpikeySphere;
class ShadowCamera;
class Terrain;
class ForceField;
class DX10ObjMesh;
class ObjMesh;
class MiniMap;
class Interface;
class SpawnPoint;
class InterfaceItems;
class LevelElement;
class QuadPNT;
class PathFinding;
class Building;
class Soldier;
class AI;

#ifdef _DEBUG
	class PhysicsDebugRenderer;
#endif

class EmptyApp : public D3DApp
{
public:
	
#ifdef _DEBUG
	enum RenderState { Normal, DebugPhysics, MixedMode };
#endif

	EmptyApp(HINSTANCE hInstance);
	~EmptyApp();
	///SetWindowParams() is called before the window is opened and enables the game to set the window title and window size
	void SetWindowParams();
	int CalculateY(int x, int z);
	void LoadMeshes();
	void LoadInterface();
	void LeftMouse(const InputState & refInputState);
	void RightMouse(const InputState & refInputState);

	///InitGame() is the place where game content is loaded and the game is initialized 
	virtual bool InitGame();
	///OnGameWindowResized(): When the window is resized, the camera may need adjusting 
	virtual bool OnGameWindowResized();
	///UpdateScene: keyboard, mouse and time can be used to change the gamestate
	virtual void UpdateScene(const InputState & m_pInputState);
	///DrawScene() is the method where the game is rendered
	virtual void DrawScene(); 
	//handle messages in this game class
	virtual void MessageProcedure(UINT message, WPARAM wParam, LPARAM lParam);
	virtual void EnterTriggerRegion();
	
private:
	
	ContentManager *m_pContentManager;
	Level *m_pLevel;	
	int m_iCameraNumber;
	bool m_Triggered;
	bool m_IsPathfindig;
	bool m_RightMouseUp, m_LeftMouseUp;
	FullScreenQuad *m_FullScreenQuad;
	ShadowCamera *m_pShadowCam;
	InputState* m_refInputState;
	DrawableTex2D *m_PostProces;
	GraphCamera* m_pGraphCamera;
	SpikeySphere* m_TestSphere;
	Terrain* m_Terrain;
	QuadPNT* m_Quad;
	vector<PathFinding*> m_HarvesterPathList;
	PathFinding* m_MakePath;
	Building* m_Tower;
	Building* m_TargetToAttack;
	bool m_HasTargetToAttack;
	ObjMesh* m_TowerMesh, *m_HarvesterMesh, *m_HouseMesh, *m_MainMesh, *m_BarracksMesh;
	bool m_PlaceBuilding;
	vector<Building*> m_Buildinglist;
	vector<Building*> m_BuildinglistEnemy;;
	vector<Building*> m_Energylist;
	vector<SpikeySphere*> m_Harvesterlist;
	Interface* m_Interface;
	vector<InterfaceItems*> m_HudItems;
	InterfaceItems* m_EndScreen;
	InterfaceItems* m_SelectRect;
	int m_IdSelected;
	bool m_BuildingSelected;
	bool m_IsSelectingSoldiers;
	bool m_IsMovingSoldiers;
	bool m_AllSoldiersMoved;
	bool m_IsTargetBuilding;
	bool m_TheEnd;
	bool m_GotMain;
	float m_Money, m_CostPrice;
	float m_MaxNumberSoldiers;
	vector<Soldier*> m_Soldierlist;
	vector<Soldier*> m_SelectedSoldierlist;
	POINTS m_MousPosRect;
	float TestY;

	MiniMap* m_MiniMap;
	GraphCamera *m_MiniMapCamera;

	AI* m_AI;

	
#ifdef _DEBUG
	RenderState m_renderstate;
	PhysicsDebugRenderer *m_pPhysicsDebugRenderer;
#endif

	DirLight m_DirLight;
};